﻿using System;
using NotifyMe.Core.DomainServices;
using NotifyMe.Core.Entities;
using NUnit.Framework;
using TechTalk.SpecFlow;

namespace NotifyMe.Specs
{
    [Binding]
    public class SaveNotificationSteps
    {
        NotificationService _notificationService;
        Notification _notification;
        int _saveResult;

        [Given(@"I have a valid Notification with a description")]
        public void GivenIHaveAValidNotificationWithADescription()
        {
            _notificationService = new NotificationService();

            _notification = new Notification { Description = "My first notification" };

            bool isValid = _notificationService.NotificationIsValid(_notification);

            Assert.AreEqual(true, isValid);
        }

        [Given(@"I have an Invalid Notification")]
        public void GivenIHaveAnInvalidNotification()
        {
            //ScenarioContext.Current.Pending();
        }


        [When(@"I save")]
        public void WhenISave()
        {
            _saveResult = _notificationService.Save(_notification);
        }

        [Then(@"I should get an Id returned")]
        public void ThenIShouldGetAnIdReturned()
        {
            Assert.GreaterOrEqual(_saveResult, 1);
        }

        [Then(@"I should get an Exception")]
        public void ThenIShouldGetAnException()
        {
            ScenarioContext.Current.Pending();
        }

    }
}
